﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows;
using System.Windows.Documents;

namespace Kokomo.PeInspector.Reflection
{
	public class CodeTextFormatItem : NotifierObject
	{
		public CodeTextFormatItem(
			CodeTextType textType,
			string label
			)
		{
			this.TextType = textType;
			this.Label = label;
		}

		public CodeTextType TextType { get; private set; }
		public string Label { get; private set; }

		private Color _color;
		public Color Color
		{
			get { return this._color; }
			set
			{
				if (this._color == value) return;

				this._color = value;
				this._brush = new SolidColorBrush(value);
				this.OnPropertyChanged("Color");
			}
		}

		private Brush _brush;
		public Brush Foreground
		{
			get { return this._brush; }
		}

		private FontWeight _fontWeight;
		public FontWeight FontWeight
		{
			get { return this._fontWeight; }
			set
			{
				this._fontWeight = value;
				this.OnPropertyChanged("FontWeight");
			}
		}

		#region Style
		public Style BuildStyle()
		{
			Style style = new Style();

			if (this.Foreground != null)
				style.Setters.Add(new Setter(TextElement.ForegroundProperty, this.Foreground));
			if (this.FontWeight != null)
				style.Setters.Add(new Setter(TextElement.FontWeightProperty, this.FontWeight));

			return style;
		}
		#endregion
	}
}
